home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
texts
/
hsc.lha
/
hsc
/
src_docs
/
features
/
expressions.hsc
< prev
next >
Wrap
Text File
|
1996-04-01
|
3KB
|
109 lines
<WEBPAGE chapter="hsc - Features - " title="Expressions"
PREV=":require.html"
NEXT="spctags.html">
<P>Additionally to simple strings, you can use expressions to set the
value of an attribute. Expressions <STRONG>must</STRONG> be enclosed
inside "<CODE>(</CODE>" and "<CODE>)</CODE>".</P>
<P>Inside expressions, you can refer to attributes simply by their name.
String constants must be enclosed inside quotes.</P>
<STRONG>Example:</STRONG><BR>
<$source PRE>
<$define name:string="hugo.gif">
<IMG SRC=(name) ALT="name">
</$source>
will be converted to
<$source PRE>
<IMG SRC="hugo.gif" ALT="name">
</$source>
<H1>Operators</H1>
Shortcuts:
<UL>
<LI><I>attr</I> stands for an attribute
<LI><I>expr</I> stands for an expression
</UL>
<H2>Unary operators</H2>
<DL>
<DT><STRONG>NOT</STRONG> <I>expr</I>
<DD>negotiate (boolean) expression
<DT><STRONG>SET</STRONG> <I>attr</I>
<DD>True, if attribute has been set during macro call
<DT><STRONG>DEFINDED</STRONG> <I>attr</I>
<DD>True, if attribute was defined with <TG>$macro</TG> or
<TG>$define</TG>
<DT><STRONG>GETENV</STRONG> <I>environment variable</I>
<DD>get value of an environment variable
</DL>
<H2>Binary operators</H2>
<DL>
<DT><I>expr</I><STRONG> = </STRONG><I>expr</I>
<DD>string comparison (case insensitive)
<DT><I>expr</I><STRONG> + </STRONG><I>expr</I>
<DD>string concatenation
</DL>
<STRONG>Example:</STRONG><BR>
<$source PRE>
<$define name:string="hugo">
<$define here:string="here">
<IMG SRC=(name+".gif") ALT=(name+" was "+here)>
<$if (name="hugo")>
This is hugo!
<$else>
Maybe it's sepp?
</$if>
AmigaOS version: <$insert text=(GetEnv "KickStart")>
</$source>
will be converted to
<$source PRE>
<IMG SRC="hugo.gif" ALT="hugo was here">
This is hugo!
AmigaOS version: 40.63
</$source>
<H2>Priorities</H2>
<P><STRONG>Important:</STRONG> Different to most programming languages, <hsc>
does not support priorities for different operators. Therefor, expressions
are simply processed sequentialy (I'm too lazy to build a tree).</P>
<P>But you can use nested brackets within complex expressions.</P>
<H1>Boolean expressions</H1>
<P>If you pass an expression to a boolean attribute, the expression is
evaluated as before. If the expression returned an empty string,
the boolean attribute is set to <CODE>FALSE</CODE>. This means, that
it is removed from the tag/macro-call.</P>
<P>Any none-empty string enables the attribute.</P>
<STRONG>Example:</STRONG><BR>
<$source PRE>
<IMG SRC=(name) ALT="nufin" ISMAP=(name="map.gif")>
</$source>
will be converted to
<$source PRE>
<IMG SRC="hugo.gif" ALT="nufin">
</$source>
if <CODE>name</CODE> has been set to <CODE>"hugo.gif"</CODE>, or to
<$source PRE>
<IMG SRC="map.gif" ALT="nufin" ISMAP>
</$source>
<P>if <CODE>name</CODE> has been set to <CODE>"map.gif"</CODE>. Note that
only the second call enables the boolean attribute <CODE>ISMAP</CODE>,
while it gets stripped for the first call.</P>
</WEBPAGE>